package Store;

public class Payment {
	private String paymentID = "";
	private String orderID  = "";
	private String cardName = "";
	private String cardType = "";
	private String cardNumber = "";
	private Integer expMonth = 0;
	private Integer expyYear = 0;
	private Integer securityCode = 000;
	private Address billingAdr = null;
	private String billingAdrID = "";
	
	public void setOrderID(String orderID) {
		this.orderID = orderID;
	}

	public String getOrderID() {
		return orderID;
	}
	
	public void setCardName(String cardName) {
		this.cardName = cardName;
	}

	public String getCardName() {
		return cardName;
	}

	public void setCardType(String cardType) {
		this.cardType = cardType;
	}

	public String getCardType() {
		return cardType;
	}

	public void setCardNumber(String cardNumber) {
		this.cardNumber = cardNumber;
	}

	public String getCardNumber() {
		return cardNumber;
	}

	public void setExpMonth(Integer expMonth) {
		this.expMonth = expMonth;
	}

	public Integer getExpMonth() {
		return expMonth;
	}

	public void setExpyYear(Integer expyYear) {
		this.expyYear = expyYear;
	}

	public Integer getExpyYear() {
		return expyYear;
	}

	public void setSecurityCode(Integer securityCode) {
		this.securityCode = securityCode;
	}

	public Integer getSecurityCode() {
		return securityCode;
	}

	public void setBillingAdrID(String billingAdrID) {
		this.billingAdrID = billingAdrID;
	}

	public String getBillingAdrID() {
		return billingAdrID;
	}

	public void setBillingAdr(Address billingAdr) {
		this.billingAdr = billingAdr;
	}

	public Address getBillingAdr() {
		return billingAdr;
	}
	
	public boolean commitPayment(){
		try{
			DatabaseAccess accessDatabase = new DatabaseAccess();
			accessDatabase.addItemToDomain(this);
		}
		catch(Exception E)
		{
			return false;
		}
		return true;
	}
	
	public static Payment[] getPayment(String paymentID){
		Payment temp[] = null;
		DatabaseAccess accessDatabase = new DatabaseAccess();
		temp = accessDatabase.getPayment(paymentID);
		return temp;
	}

	public void setPaymentID(String paymentID) {
		this.paymentID = paymentID;
	}

	public String getPaymentID() {
		return paymentID;
	}
}
